/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.pojo.sqlServer;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* @website https://eladmin.vip
* @description /
* @author xinglin
* @date 2024-08-03
**/
@Entity
@Data
@Table(name="pp_device_status")
public class PPDeviceStatus implements Serializable {

    @Id
    @Column(name = "`id`")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`code`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "码垛机编号")
    private String code;

    @Column(name = "`warehouse_code`")
    @ApiModelProperty(value = "仓库编号(RTL，PP)")
    private String warehouseCode;

    @Column(name = "`equipment_type`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "设备类型")
    private Integer equipmentType;

    @Column(name = "`aisle`")
    @ApiModelProperty(value = "巷道号")
    private Integer aisle;

    @Column(name = "`layer`")
    @ApiModelProperty(value = "层号")
    private Integer layer;

    @Column(name = "`status`")
    @ApiModelProperty(value = "设备状态 (0-初始 1-正常 2-异常)")
    private Integer status;

    @Column(name = "`last_updated`")
    @ApiModelProperty(value = "设备状态变更时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
    private LocalDateTime lastUpdated;

    public void copy(PPDeviceStatus source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
